package com.wsd.common.entity;


import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.databind.ObjectMapper;

public class UserAccessTokenEntity {

    @JsonAlias("access_token")
    private String accessToken;

    @JsonAlias("expires_in")
    private Integer expiresIn;

    public static UserAccessTokenEntity build(String response) {
        try {
            return new ObjectMapper().readValue(response, UserAccessTokenEntity.class);
        } catch (Exception e) {
            return null;
        }
    }

    @Override
    public String toString() {
        return "UserAccessTokenEntity{" +
                "accessToken='" + accessToken + '\'' +
                ", expiresIn=" + expiresIn +
                '}';
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public Integer getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(Integer expiresIn) {
        this.expiresIn = expiresIn;
    }

}
